package com.zahb.qadx.ui.adapter;


import android.text.TextUtils;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.module.LoadMoreModule;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.zahb.qadx.R;
import com.zahb.qadx.model.StudyRecordBean;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.List;


public class StudyRecordAdapter extends BaseQuickAdapter<StudyRecordBean.ListEntity, BaseViewHolder> implements LoadMoreModule {
    public StudyRecordAdapter(int layoutResId, @Nullable List<StudyRecordBean.ListEntity> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(@NotNull BaseViewHolder baseViewHolder, StudyRecordBean.ListEntity s) {

        baseViewHolder.setText(R.id.tvTime,s.getCreateTime())
                .setText(R.id.tvType,s.getCateName())
                .setText(R.id.tvName,s.getCourseName())
                .setText(R.id.tvTimeLength,s.getCourseHours()+"")
                .setText(R.id.tvStatus,TextUtils.isEmpty(s.getLearn_status())?"待完成":"已完成");


    }


    public String getStatus(int status){
        if(status==0){
            return "未颁发";
        }
        if(status==1){
            return "已颁发";
        }
        if(status==2){
            return "无证书";
        }
        return "";
    }

}
